ABC254 C - K Swap
提出
code: python
n, k = map(int, input().split())
a = list(map(int, input().split()))
# 3 4 1 3 4
# 1 3 3 4 4
# 大抵は行ける気がする 端にあったら無理
解答
code: python
n, k = map(int, input().split())
a = list(map(int, input().split())) # 3 4 1 3 4
b = [[] for _ in range(k)]
# i を k で割った余りごとに管理
# 3, 1, 4 / 4, 3
for i, v in enumerate(a):
for i in range(k):
# print(b) 1, 3, 4], [3, 4
for i in range(n):
# print(i % k, i // k)
# 0 0
# 1 0
# 0 1
# 1 1
# 0 2
print("Yes" if res == sorted(a) else "No")
メモ
https://www.youtube.com/watch?v=81PhR_8l_F8&t=2160s
提出
WA
code: python
n, k = map(int, input().split())
a = list(map(int, input().split()))
b = a
for i in range(n-k-1):
print("Yes") if a == sorted(b) else print("No")